package com.econ.powercloud.ems.common.enums;

/**
 * @Author : wan
 * @Description : 消防系统中设备状态
 * @Date : 2020/12/19 17:11
 * @Modified by : wan
 */
public enum DeviceStatusType implements EnumMethod {

    OFF(0, "正常"),

    ON(1, "故障"),;

    private Integer code;
    private String desc;

    @Override
    public Integer getCode() {
        return code;
    }

    @Override
    public String getDesc() {
        return desc;
    }

    DeviceStatusType(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static DeviceStatusType fromCode(Integer code) {
        for (DeviceStatusType type : DeviceStatusType.values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        return null;
    }
}
